Ensuring the confidentiality of message transmission is a fundamental security requirement for communications in Vehicular Ad hoc NETworks (VANETs). While utilizing symmetric group keys to encrypt messages, it is hard for system manager to trace inner attackers. Therefore, an attribute-based encryption scheme for VANETs was proposed. The scheme enables tracking and revocation of malicious vehicles and fine-grained division of vehicle access rights; meanwhile, the scheme allows multiple authority centers to distribute attributes and their corresponding keys independently, preventing compromised authority centers from forging attribute keys that are managed by other authorities, thus guaranteeing a high security for communication and collaboration among multiple institutions. This scheme was proven indistinguishable under q-DPBDHE2 (q-Decisional Parallel Bilinear Diffie-Hellman Exponent) assumption; and experimental results of encryption and decryption overhead comparison of this scheme and similar schemes show that while the number of attributes is 10, the decryption overhead of the proposed scheme is 459.541 ms, indicating that the scheme is suitable for communication encryption in VANETs.